package com.lujieni.nio.c1;

import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;

public class TestByteBufferString {

    public static void main(String[] args) {
        ByteBuffer allocate = ByteBuffer.allocate(8);
        allocate.put("hello我".getBytes());
        allocate.flip(); // 切换到读模式
        System.out.println(StandardCharsets.UTF_8.decode(allocate));
    }

}
